package com.lxq.test1803.main02;

import java.util.Scanner;

public class Main {

    public static void quickSort(int[][] a, int low, int hight,int key) {
        int i, j, index;

        if (low > hight) {
            return;
        }
        i = low;
        j = hight;
        index = a[i][key]; // 用子表的第一个记录做基准
        int[] temp = a[i];
        while (i < j) { // 从表的两端交替向中间扫描
            while (i < j && a[j][key] >= index)
                j--;
            if (i < j)
                a[i++] = a[j];// 用比基准小的记录替换低位记录
            while (i < j && a[i][key] < index)
                i++;
            if (i < j) // 用比基准大的记录替换高位记录
                a[j--] = a[i];
        }
        a[i] = temp;// 将基准数值替换回 a[i]
        quickSort(a, low, i - 1,key); // 对低子表进行递归排序
        quickSort(a, i + 1, hight,key); // 对高子表进行递归排序

    }

    public static void bang(int[][] a,int n,int L){
        if (a[0][0]==0&&a[0][1]==-1){
            a[0][1]=1;
        }
        if (a[n-1][0]==L&&a[n-1][1]==1){
            a[n-1][1]=-1;
        }
        for (int i=0; i<n-1; i++){
            if (a[i][0]==a[i+1][0]&&a[i][1]==1&&a[i+1][1]==-1){
                a[i][1]=-1;
                a[i+1][1]=1;
            }
        }
    }
    public static void run(int[][] a,int n){
        for (int i=0;i<n;i++){
            a[i][0] += a[i][1];
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n,L,t;

        n=sc.nextInt();
        L=sc.nextInt();
        t=sc.nextInt();

        int[][] a = new int[n][3];
        for (int i=0 ;i<n ;i++){
            a[i][0]=sc.nextInt();
            a[i][1]=1;//正方向运动
            a[i][2]=i;//编号
        }
        //快排排序
        quickSort(a, 0, n-1,0);


        for (int i=0; i<t ;i++){

            run(a,n);
            bang(a,n,L);

        }

        //快排排序
        quickSort(a,0,n-1,2);


        for (int[] x:a
        ) {
            System.out.print(x[0]+" ");
        }

    }
}
